new Vue({
  el: "#app",
  data: {
    player: null,
    source: "../../js/lib/aliplayer/movie.mp4",
    cover: "",
  },
  created() {
    // this.source = getUrlKey("link")
    setTimeout(() => {
      // confirm("播放失败，请稍后再试")

      var userConfirmed = confirm("您确定要执行这个操作吗？")

      if (userConfirmed) {
        // 用户点击了“确定”
        console.log("用户已确认操作。")
        this.$dialog.alert({
          message: "用户已确认操作。",
        })
        // 在这里执行相关操作
      } else {
        // 用户点击了“取消”或关闭了对话框
        console.log("用户已取消操作。")
        // 可以在这里处理取消操作的情况
      }
    }, 3000)
  },
  destroyed() {},
  mounted() {
    this.doPlay()
  },
  methods: {
    //播放

    doPlay() {
      this.player = new Aliplayer(
        {
          id: "playerCon",
          source: this.source,
          cover: this.cover, //封皮
          width: "100%",
          height: "250px",
          autoplay: false,
          isLive: false,
          rePlay: false,
          playsinline: true,
          preload: true,
          controlBarVisibility: "always",
          useH5Prism: true,
          skinLayout: [
            {
              name: "controlBar",
              align: "blabs",
              x: 0,
              y: 0,
              children: [
                {
                  name: "playButton",
                  align: "tl",
                  x: 15,
                  y: 12,
                },
                {
                  name: "progress",
                  align: "blabs",
                  x: 0,
                  y: 44,
                },
                {
                  name: "timeDisplay",
                  align: "tl",
                  x: 10,
                  y: 7,
                },
                {
                  name: "fullScreenButton",
                  align: "tr",
                  x: 10,
                  y: 12,
                },
              ],
            },
          ],
        },
        function (player) {
          console.log("The player is created")
          // player.getStatus((res) => {
          //   console.log('getStatus', res)
          // })
        }
      )
      this.player.el().style.height = "100vh"
    },
  },
})
